﻿using System;
using System.Xml.Serialization;

namespace RssToolkit.Rss
{
    /// <summary>
    /// Использование .GetParam(PostParams.MediaThumbnail).ToString() - правильно!
    ///  <media:content url="http://i.juick.com/photos-1024/1743753.jpg" type="image/jpeg"/>
    ///  <media:thumbnail url="http://i.juick.com/ps/1743753.jpg"/>
    /// </summary>
    [Serializable]
    public class Media
    {
        public override string ToString()
        {
            return thumbnail==null?url:thumbnail.url;
        }

        [XmlAttribute("url", Namespace = "http://search.yahoo.com/mrss/")] 
        public string url;

        [XmlAttribute("type", Namespace = "http://search.yahoo.com/mrss/")] 
        public string type;

        [XmlElement("thumbnail", Namespace = "http://search.yahoo.com/mrss/")]
        public Thumbnail thumbnail;

        [XmlElement("credit", Namespace = "http://search.yahoo.com/mrss/")]
        public string credit;

        /// <summary>
        /// Tags
        /// </summary>
        [XmlElement("category", Namespace = "http://search.yahoo.com/mrss/")]
        public string category;

    }

}